<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>礼包列表</title>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/js/common/bootstrap/css/bootstrap.min.css">

<!-- 可选的Bootstrap主题文件（一般不用引入） -->
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/js/common/bootstrap/css/bootstrap-theme.min.css">

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="${pageContext.request.contextPath }/js/jquery-3.1.1.min.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script
	src="${pageContext.request.contextPath }/js/common/bootstrap/js/bootstrap.min.js"></script>

</head>
<body>
<hr>
		<form class="form-inline" id="myform">
			<table border="0" cellspacing="0" cellpadding="10" width="1500px">
				<tr>
					<td width="10%" align="right">礼包编号：</td>
					<td width="10%"><input type="text" id="bag_id"
						name="bag_id" value=""  /></td>
					<td width="10%" align="right">礼包名称：</td>
					<td><input type="text" id="bag_name" name="bag_name" 
						value=""  /></td>
						<td width="8%" align="right">状态：</td>
						<td><select name="status" id="status" class="form-control">
							<option value="">全部</option>
							<option value="1">在售</option>
							<option value="2">下架</option>
					</select></td>
					<td width="60%" rowspan="2">&nbsp; &nbsp; &nbsp;
						<button class="btn btn-primary btn-sm" type="submit" id="submit">
						<span class="glyphicon glyphicon-search" aria-hidden="true"></span>查询</button>
						<button type="reset" class="btn btn-primary btn-sm">
						<span class="glyphicon glyphicon-repeat" aria-hidden="true">重置</button> 
						<!--新增按钮 -->
						<a href="toadd" class="btn btn-primary btn-sm" role="button">
						<span class="glyphicon glyphicon-plus" aria-hidden="true">新增</a>
						
					</td>
				</tr>
			</table>
		</form>
		<hr>

<table  data-toggle="table" class="table table-condensed table-striped">
			<tr>
				<td>礼包编号</td>
				<td>礼包名称</td>
				<td>礼包价格</td>
				<td>开卡数量</td>
				<td>剩余卡数量</td>
				<td>上架时间</td>
				<td>下架时间</td>
				<td>过期时间(天)</td>
				<td>状态</td>
				<td>创建时间</td>
				<td>排序号</td>
				<td></td>
			</tr>
			<c:forEach items="${list }" var="bag">
				<tr>
					<td>${bag.bag_id }</td>
					<td>${bag.bag_name }</td>
					<td>${bag.bag_total_price }</td>
					<td>${bag.open_card_num }</td>
					<td>${bag.remain_num }</td>
					<td>${bag.putaway_time }</td>
					<td>${bag.soldout_time }</td>
					<td>${bag.overdue_time }</td>
					<td>${bag.status==1?"在售":"下架" }</td>
					<td>${bag.create_time }</td>
					<td>${bag.sort_no }</td>
					<td><a class="btn btn-primary btn-xs"
						href="delBag/${bag.bag_id }" role="button"> <span
							class="glyphicon glyphicon-trash" aria-hidden="true"></span> 删除
					</a>
					<!-- 修改 -->
						<a href="updateBag/${bag.bag_id }" class="btn btn-primary btn-xs" role="button">
						<span class="glyphicon glyphicon-cog" aria-hidden="true">修改</a>
						<!-- 查看详情 -->
						 <a class="btn btn-primary btn-xs"  data-toggle="modal" data-target="#myModal"
						href="selectBagById/${bag.bag_id }" role="button">
						 <span class="glyphicon glyphicon-zoom-in" aria-hidden="true"></span>
					</a>
					
					</td>

				</tr>
			</c:forEach>
		</table>


<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="static" data-keyboard="false"	>
  <div class="modal-dialog" role="document" style="width:1050px">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      </div>
      <div class="modal-body">
      	<iframe src="http://127.0.0.1:8085/bsc/jhy/selectBagById"></iframe>
      </div>
      <div class="modal-footer">
      </div>
    </div>
  </div>
</div>
</body>
</html>
<script type="text/javascript">

$(document).ready(function() {
	$('#myform').submit(function() {	//这次我们这么绑定
		var contact = $("input[name='bag_id']").val();
		var title = $("input[name='bag_name']").val();
		var errmessage = $("textarea[name='status']").val();				
		var err_data = {
				bag_id: bag_id,
				bag_name: bag_name,
				status: status
		}
		$.ajax({
			// ajax提交代码....
			 type:'post',  
			    url:'/bsc/jhy/bagList', 
			    cache: false,
			    data:data,  
			    dataType:'json', 
			    success:function(data){      
			      alert('success');
			    }
		});
			return false;	//还是要return false, 跟上面一样的道理
	});
});



<!--

//-->
</script>